#pragma once
#include"myMiniEngine/Renderer/Shader.h"
#include"glm/glm.hpp"
#include"mgepch.h"
#include<unordered_map>


typedef unsigned int GLenum;

namespace myMiniEngine {
	class OpenGLShader :public Shader {

	public:
		OpenGLShader(const std::string& filepath);

		OpenGLShader(const std::string& name, const std::string& vertexSrc, const std::string& fragmentSrc);
		virtual ~OpenGLShader();

		virtual void Bind() const override;
		virtual void UnBind() const override;

		virtual const std::string& GetName() const override { return name; };


		void UploadUniformInt(const std::string& name, int value);
		void UploadUniformFloat(const std::string& name, float values);
		void UploadUniformFloat2(const std::string& name, const glm::vec2& values);
		void UploadUniformFloat3(const std::string& name, const glm::vec3& values);
		void UploadUniformFloat4(const std::string& name, const glm::vec4& values);

		void UploadUniformMat3(const std::string& name, const glm::mat3& matrix);
		void UploadUniformMat4(const std::string& name, const glm::mat4& matrix);

	private:
		std::string ReadFile(const std::string& filepath);
		std::unordered_map<GLenum, std::string> SplitSource(const std::string& source);
		void Compile(std::unordered_map<GLenum, std::string>& shaderSources);
	private:
		uint32_t rendererID;
		std::string name;


	};

}